#!/usr/bin/perl
use warnings;
use strict;
use autodie;
use 5.010;


say '<div>';
say '<table>';

my $index=0;
	
while (<>) {
	$index = $index + 1;
	chomp;
	my @row_content = split /\t/, $_, -1;
	print '<tr>';
	
	if ($index==1) {
		foreach (@row_content) {
			print '<th>';
			print $_;
			print '</th>';
		}
	}else {
		foreach (@row_content) {
			
			
			 print '<td>';
			 if ($_) {
				if (/^rs\d+/) {
					print '<a href="http://www.ncbi.nlm.nih.gov/SNP/snp_ref.cgi?rs=' . "$_\" target=\"_blank\">" . "$_<\/a>";
				}elsif (/^COSM(\d+)/) {
					print '<a href="http://cancer.sanger.ac.uk/cosmic/mutation/overview?id=' . "$1\" target=\"_blank\">" . "$_<\/a>";
				}else {
					print $_;
				}
			 }else {
				print '&nbsp';
			 }
			 print '</td>'; 
		}
	
	}
	say '</tr>';
}


say '</table>';
say '</div>';
